<?php /* @var $this Controller */ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="language" content="en" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Fchic.Vn - The fashion social network</title>
        <meta content="index, follow" name="robots"/>
        <meta content="Fchic.Vn" name="description"/>
        <meta content="Fchic.Vn" name="keywords"/>
        <meta name="ROBOTS" content="index, follow" />
        <!-- blueprint CSS framework -->
        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/carousel.css" />
        <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,300,800&subset=vietnamese' rel='stylesheet' type='text/css' />
        <link href='http://fonts.googleapis.com/css?family=Patrick+Hand&subset=vietnamese' rel='stylesheet' type='text/css' />

        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery-1.7.1.min.js" type="text/javascript"></script>
        <!--<script src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.js" type="text/javascript"></script>-->
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/grid.js" type="text/javascript"></script>
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/tabs.js" type="text/javascript"></script>
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/js_customize.js" type="text/javascript"></script>
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/carousel.js" type="text/javascript"></script>

        <script src="<?php echo Yii::app()->request->baseUrl; ?>/ckeditor/ckeditor.js"></script>
    </head>

    <body>
        <div id="wrapper">
            <!-- topbar -->
            <div id="topbar"><div id="topbar_content">
                    <?php
                    if (Yii::app()->user->id == null) {
                        $login = new LoginForm();
                        ?>
                    <div id="topbar_right"><a href="<?php echo Yii::app()->createUrl('user/register1'); ?>">Đăng ký thành viên</a><a id="login" href="#"><span>Đăng nhập</span></a></div>
                        <div class="login_panel">
                            <div class="content">
                                <?php
                                $form = $this->beginWidget('CActiveForm', array(
                                    'id' => 'login-form',
                                    'action' => array(
                                        'user/login/'
                                    ),
                                    'enableClientValidation' => true,
                                    'clientOptions' => array(
                                        'validateOnSubmit' => true
                                    )
                                ));
                                ?>                             
                                <?php echo $form->textField($login, 'username', array('class' => 'lp_input', 'placeholder' => 'Tên đăng nhập / Email')); ?>
                                <?php echo $form->passwordField($login, 'password', array('class' => 'lp_input', 'placeholder' => 'Mật khẩu')); ?>
                                <div>
                                    <?php echo CHtml::submitButton('Đăng nhập', array('class' => 'gr_btn_big')); ?>
                                    <div class="fll lp_forget"><a href="#" title="Quên mật khẩu">Quên mật khẩu ?</a></div>
                                    <div class="clr"></div>
                                </div>
                                <?php $this->endWidget(); ?>
                                <div class="login_via">Đăng nhập nhanh qua <a href="#" title="Facebook" class="sprites login_iconfb"></a><a href="#" title="Google Plus" class="sprites login_icongg"></a></div>
                            </div>
                        </div>
                        <?php
                    } else {
                        $notify = User::getNotify(Yii::app()->user->id);
                        ?>
                        <div id="topbar_right" class="bar-logged">
                            <div id="bar-cp">Hi, <span><?php echo Yii::app()->user->getState('fullname') ?></span>
                                <div class="logged_panel panel">
                                    <div class="avatar">
                                        <img src="<?php echo Yii::app()->baseUrl . '/upload/user/' . Yii::app()->user->id . '/avatar/' . Yii::app()->user->getState('avatar'); ?>" border="0" title="#" alt="#" />
                                        <a href="#" class="dlb" title="#">Thay avatar</a>
                                    </div>
                                    <div class="dib">
                                        <a href="#" title="" class="lp-li">Xem trang cá nhân</a>
                                        <a href="#" title="" class="lp-li">Xem album ảnh</a>
                                        <a href="#" title="" class="lp-li">Xem bạn bè</a>
                                        <a href="#" title="" class="lp-li" style="border-bottom: none;">Quản lý thông tin cá nhân</a>
                                    </div>
                                    <div class="clr"></div>
                                    <div class="lp-logout"><?php echo CHtml::link('Thoát', array('user/logout')); ?></div>
                                </div>
                            </div>
                            <!--<a href="#" id="bar-feed"><span class="sprites icon_feed"></span></a>-->
                            <div id="bar-feed">
                                <span class="feed-numb"><?php echo User::getNotifyCount(Yii::app()->user->id); ?></span>
                                <div class="panel feed_panel">
                                    <div class="fp-title">Thông báo</div>
                                    <?php
                                    foreach ($notify as $n) {
                                        $u = $n->user;
                                        $img = $n->image;
                                        switch ($n->active_type) {
                                            case UserActive::LIKE_IMG:
                                                ?>
                                                <div class="fp-li">
                                                    <a href="<?php echo Yii::app()->createUrl('image/view', array('id' => $img->id)); ?>" title="">
                                                        <img class="avatar" src="<?php echo Yii::app()->baseUrl . '/upload/user/' . $u->id . '/avatar/' . $u->avatar; ?>" border="0" />
                                                        <div class="fll fll-photo"><strong><?php echo $u->fullname ?></strong> đã like ảnh của bạn.<span class="feed-time"><?php echo Format::timeAgo($n->active_at, 'Y-m-d H:i:s'); ?></span></div>
                                                        <div class="fll-photo-img"><img src="<?php echo Yii::app()->baseUrl . '/upload/user/' . $img->user_created . '/images/' . $img->img_url; ?>" border="0" alt="#" /></div>
                                                    </a>
                                                </div>
                                                <?php
                                                break;
                                            case UserActive::COMMENT_IMG:
                                                ?>
                                                <div class="fp-li">
                                                    <a href="<?php echo Yii::app()->createUrl('image/view', array('id' => $img->id)); ?>" title="">
                                                        <img class="avatar" src="<?php echo Yii::app()->baseUrl . '/upload/user/' . $u->id . '/avatar/' . $u->avatar; ?>" border="0" />
                                                        <div class="fll fll-photo"><strong><?php echo $u->fullname ?></strong> đã bình luận ảnh.<span class="feed-time"><?php echo Format::timeAgo($n->active_at, 'Y-m-d H:i:s'); ?></span></div>
                                                        <div class="fll-photo-img"><img src="<?php echo Yii::app()->baseUrl . '/upload/user/' . $img->user_created . '/images/' . $img->img_url; ?>" border="0" alt="#" /></div>
                                                    </a>
                                                </div>
                                                <?php
                                                break;
                                            case UserActive::LIKE_COLLECTION:
                                                break;
                                            case UserActive::COMMENT_COLLECTION:
                                                break;

                                            default:
                                                break;
                                        }
                                    }
                                    ?>
                                    
                                    <div class="fp-all"><a href="#" title="#">Xem tất cả</a></div>
                                    <div class="clr"></div>
                                </div>
                            </div>
                            <div id="bar-upload">
                                <a href="#" title="#">Up ảnh</a>
                            </div>
                            <div class="clr"></div>
                        </div>
                        <?php
//                        echo CHtml::link(User::model()->getFullName(Yii::app()->user->id), array('user/view', 'username' => User::model()->getUserName(Yii::app()->user->id)));
                        echo CHtml::link('Thoát', array('user/logout'));
                    }
                    ?>
                </div>
            </div>
            <!--- / topbar -->
            <!-- header -->
            <div id="header">
                <div id="beta" class="sprites"></div>
                <div id="header_content">
                    <a id="logo" href="<?php echo Yii::app()->homeUrl; ?>" title="Fchic.vn"></a>
                    <div id="version">v.1</div>
                    <div id="category">
                        <div id="cate_content">
                            <span><a href="#" class="cate_link" title="Styles"><span class="cate_icon sprites"></span> Styles</a>
                                <ul class="cate_expand">
                                    <?php
                                    $styles = Style::model()->findAll('status=1');
                                    foreach ($styles as $style) {
                                        ?>
                                        <li><a href="#" title="Street style"><?php echo $style->name; ?></a></li>
                                    <?php } ?>
                                </ul>
                            </span>
                        </div>
                    </div>
                    <div id="topmenu">
                        <ul>
                            <li><a class="active" href="hot.html" title="Hot">Hot</a></li>
                            <li><a href="<?php echo Yii::app()->createUrl('site/new') ?>" title="New">New</a></li>
                            <li><a href="top.html" title="Top">Top</a></li>
                            <li><a href="leader.html" title="Leader">Leader</a></li>
                            <div class="clr"></div>
                        </ul>
                    </div>
                    <div id="topsearch">
                        <input class="ts_input" type="text" onfocus="if (this.value == 'Search trend, model, clothes ...') {
                                    this.value = ''
                                }" onblur="if (this.value == '') {
                                            this.value = 'Search trend, model, clothes ...'
                                        }" value="Search trend, model, clothes ..." name="search">
                    </div>
                </div>
            </div>
            <!-- / header -->
            <?php echo $content; ?>
            <!-- footer -->
            <div id="footer">
                <div id="footer_content">
                    <div class="ft_col ft_col_first">
                        <a href="#" title="Về Fchic.vn">Về Fchic.vn</a>
                        <a href="#" title="Trợ giúp">Trợ giúp</a>
                        <a href="#" title="Liên hệ">Liên hệ</a>
                    </div>
                    <div class="ft_col">
                        <a href="#" title="Quy định sử dụng">Quy định sử dụng</a>
                        <a href="#" title="Điều khoản">Điều khoản</a>
                        <a href="#" title="Ý kiến phản hồi">Ý kiến phản hồi</a>
                    </div>
                    <div class="ft_col">
                        <a href="#" title="Xu hướng nổi bật">Xu hướng nổi bật</a>
                        <a href="#" title="Rss">Rss</a>
                        <a href="#" title="Site maps">Site maps</a>
                    </div>
                    <div class="ft_apps">
                        Ứng dụng Fchic.vn trên di động
                        <p>
                            <a href="#" title="iOs" class="fta_icon sprites"></a><a href="#" title="Android" class="fta_icon sprites fta_android"></a><a href="#" title="WindowsPhone" class="fta_icon fta_windows sprites"></a>
                        </p>
                    </div>
                    <div class="ft_copyright">
                        © 2013 Fchic.vn - the fashion social network. All rights reserved.
                        <p>
                            <a href="#" title="Facebook" class="sprites ft_icons icon_fb"></a>
                            <a href="#" title="Twitter" class="sprites ft_icons icon_tw"></a>
                            <a href="#" title="Google+" class="sprites ft_icons icon_gg"></a>
                            <a href="#" title="Youtube" class="sprites ft_icons icon_yt"></a>
                            <a href="#" title="Tumblr" class="sprites ft_icons icon_tr"></a>
                            <a href="#" title="Instagram" class="sprites ft_icons icon_ig"></a>
                            <a href="#" title="Pinterrest" class="sprites ft_icons icon_pin"></a>
                        </p>
                    </div>
                    <div class="clr"></div>
                </div>
            </div>
            <!-- / footer -->
        </div>
    </body>
</html>
